# -*- coding: utf-8 -*-
# author: AZJ
# date: 2024/11/9
# 假如命运扼住了你的咽喉，你就去挠她的咯吱窝
class Solution(object):
    def minCostClimbingStairs(self, cost):
        """
        :type cost: List[int]
        :rtype: int
        """
        # dp[i]到 i 的最小花费
        # dp[i] = min(dp[i-1]+cost[i-1], dp[i-2]+cost[i-2])
        n = len(cost)
        dp = [0 for i in range(n+1)]
        dp[0] = 0
        dp[1] = 0
        for i in range(2, n+1):
            dp[i] = min(dp[i-1]+cost[i-1], dp[i-2]+cost[i-2])
        return dp[n]
if __name__ == '__main__':
    s = Solution()
    print(s.minCostClimbingStairs([1, 100, 1, 1, 1, 100, 1, 1, 100, 1]))